package com.csw.shuanfa.SuanFa.huaWei;

import lombok.extern.slf4j.Slf4j;

import java.util.Scanner;

/**
 * 连续输入字符串(输入多次,每个字符串长度小于100)
 * <p>
 * 输出描述: 输出到长度为8的新字符串数组
 *
 * @author 1
 */
@Slf4j
public class StringSubString {

    public static void main(String[] args) {
        int eight = 8;
        Scanner sc = new Scanner(System.in);
        StringBuilder longString = new StringBuilder();
        while (sc.hasNext()) {
            String aa = sc.next();
            if ("".equals(aa)) {
                break;
            }
            StringBuilder oo = new StringBuilder();
            log.error("" + "需要补" + (int) (eight - aa.length() % eight) + "个0");
            if ((aa.length() % eight) != 0) {
                for (int i = 0; i < eight - aa.length() % eight; i++) {
                    oo.append("0");
                    log.info("" + "00]" + oo);
                }
            }

            longString.append(aa).append(oo);

        }
        for (int i = 0; i < longString.length() - 1; i++) {
            String out = longString.substring(i, i + eight);
            log.info("" + out);
            if (i <= longString.length() - eight) {
                i += 7;
            }
        }
    }
}
